package day07;
import java.lang.reflect.Type;

import static day07.Guessing.*;
//import static day07.Guessing.getScanner;

public class CalAirPrice {
    public static void main(String[] args) {
        while (true) {
            System.out.println("请输入机票价格");
            int price = getScanner();
            System.out.println("请输入月份");
            int month = getScanner();
            System.out.println("请输入舱位1.头等舱2.商务舱3.经济舱");
            int type = getScanner();
            if (calAirPrice(price, month, type) < 0) {
                System.out.println("不对奥");
            } else {
                System.out.println("价格为" + calAirPrice(price, month, type));
                break;
            }
        }
    }
    //机票价格计算
    private static double calAirPrice(int price, int month,int Type){
        double a = 0.0;
        if (price<0||month<0||month>12||Type<0||Type>3){
            return -1;
        }else {
            switch (month) {
                case 3:
                case 4:
                case 5:
                case 6:
                case 2:
                    switch (Type) {
                        case 1:
                            a = price * 0.2;
                            break;
                        case 2:
                            a = price * 0.3;
                            break;
                        case 3:
                            a = price * 0.4;
                            break;
                    }
                case 1:
                case 7:
                case 8:
                case 9:
                case 10:
                case 11:
                case 12:
                    switch (Type) {
                        case 1:
                            a = price * 0.6;
                            break;
                        case 2:
                            a = price * 0.7;
                            break;
                        case 3:
                            a = price * 0.8;
                            break;
                    }
            }
        }
        return a;
    }
}
